import request from '@/utils/request'

// 查询库存记录列表
export function listWmstock(query) {
  return request({
    url: '/mes/wm/wmstock/list',
    method: 'get',
    params: query
  })
}

// 查询 库存总数量 总金额
export function getAllTotal(query) {
  return request({
    url: '/mes/wm/wmstock/getAllTotal',
    method: 'get',
    params: query
  })
}
// 根据补料单ID 查询库存记录列表
export function listWmstockByIssueId(query) {
  return request({
    url: '/mes/wm/wmstock/listByIssueId',
    method: 'get',
    params: query
  })
}

// 查询库存总量记录列表
export function getTotalList(query) {
  return request({
    url: '/mes/wm/wmstock/getTotalList',
    method: 'get',
    params: query
  })
}

// 查询库存记录列表不分页
export function getListWmstock(query) {
  return request({
    url: '/mes/wm/wmstock/getList',
    method: 'get',
    params: query
  })
}
// 查询库存记录详细
export function getWmstock(materialStockId) {
  return request({
    url: '/mes/wm/wmstock/' + materialStockId,
    method: 'get'
  })
}

// 新增库存记录
export function addWmstock(data) {
  return request({
    url: '/mes/wm/wmstock',
    method: 'post',
    data: data
  })
}

// 修改库存记录
export function updateWmstock(data) {
  return request({
    url: '/mes/wm/wmstock',
    method: 'put',
    data: data
  })
}

// 删除库存记录
export function delWmstock(materialStockId) {
  return request({
    url: '/mes/wm/wmstock/' + materialStockId,
    method: 'delete'
  })
}

// 根据物料code获取库存
export function listStockByCode(itemCode) {
  return request({
    url: '/mes/wm/wmstock/code' ,
    method: 'get',
    params: {'itemCode': itemCode}
  })
}

// 根据批次号获取库存
export function getStockByBatch(data) {
  return request({
    url: '/mes/wm/wmstock/batchCode' ,
    method: 'post',
    data: data
  })
}

// 查询库存记录列表
export function listStock(query) {
  return request({
    url: '/mes/wm/wmstock/list2',
    method: 'get',
    params: query
  })
}
export function getValidityList(query) {
  return request({
    url: '/mes/wm/wmstock/getValidityList',
    method: 'get',
    params: query
  })
}
// 查询库存记录详细 有效期预警用 携带质保期
export function getInfoFor(materialStockId) {
  return request({
    url: '/mes/wm/wmstock/getInfoFor/' + materialStockId,
    method: 'get'
  })
}

// 客户调拨 根据计划中的bom 显示库存记录
export function selectStockByPlanBom(data) {
  return request({
    url: '/mes/wm/wmstock/selectStockByPlanBom',
    method: 'post',
    data: data
  })
}
